﻿CREATE TABLE [dbo].[Usuario] (
    [UsuarioId]                   INT            IDENTITY (1, 1) NOT NULL,
    [Contraseña]                  NVARCHAR (128) NOT NULL,
    [FechaCreacion]               DATETIME       DEFAULT (getdate()) NOT NULL,
    [FechaUltimoIngreso]          DATETIME       NULL,
    [FechaUltimoCambioContraseña] DATETIME       NULL,
    [NombreUsuario]               VARCHAR (50)   NOT NULL,
    [Activo]                      BIT            CONSTRAINT [DF_Usuario_Activo] DEFAULT ((1)) NOT NULL,
    [RolId]                       INT            NOT NULL,
    CONSTRAINT [PK_Usuario] PRIMARY KEY CLUSTERED ([UsuarioId] ASC) WITH (FILLFACTOR = 80),
    CONSTRAINT [FK_Usuario_Rol] FOREIGN KEY ([RolId]) REFERENCES [dbo].[Rol] ([RolId])
);